#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time    : 2021/10/21 14:37
@Author  : Chenlj
@File    : test1_clean_token.py
"""
import allure, pytest, json
from Common import AssertInfo, Public
from Common.Func import refresh_token


@allure.feature('清除用户token')
class TestRefreshToken:
    """
    清除token
    """

    @allure.step('断言信息：')
    def step_with_assert_info(self, response, expected):
        pass

    @allure.step('执行步骤：')
    def step_introduce(self, first=None, second=None, third=None):
        pass
    
    @allure.description('每次执行测试前先刷新token')
    @allure.title('清除token')
    @pytest.mark.usefixtures('action')
    @pytest.mark.run(order=1)
    def test_refresh_token(self, action):
        
        res, data = refresh_token()
        Public.api_except(res)
        Public.attach_info(res, data)
        self.step_with_assert_info(AssertInfo.StatusText + str(res.json()['STATUS']),
                                   AssertInfo.ExpectedText + str(AssertInfo.SucceedStatus))
        action.assert_code(res.json()['STATUS'], AssertInfo.SucceedStatus)


if __name__ == '__main__':
    trt = TestRefreshToken
    trt.test_refresh_token(trt)
